<?php
/**
 *
 * @author ninetyseven.
 * @date 2023-03-30 22:11
 */

namespace App\Enum;

class RedisEnum
{
    /**
     * 渗透方法 ，可以穿透redis
     */
    public const R_PENETRATE_KEY='through'; // 以env的数值优先
    /**
     * 默认过期时间 - 半小时
     */
    public const EXPIRE_TIME_DEFAULT = 1800;
    /**
     * 默认过期时间 - 一天
     */
    public const EXPIRE_TIME_DEFAULT_DAY = 86400;
    /**
     * 默认过期时间 - 半天
     */
    public const EXPIRE_TIME_DEFAULT_DAY_HALF = 86400/2;
    /**
     * 默认过期时间 - 5天
     */
    public const EXPIRE_TIME_DEFAULT_DAYS = 86400 * 5;
    // 用于后台管理 这些key的清除
    public const R_KEYS = [
        self::R_INDEX_ARTICLES_TOP_KEY=>['置顶文章','index'],
        self::R_INDEX_DONATION_TOP_KEY=>['捐赠排行','index'],
        self::R_INDEX_ARTICLES_DETAIL_KEY=>['文章详情','article']
    ];

    // 捐赠排行
    public const R_INDEX_DONATION_TOP_KEY = 'dona-top-9yKxz';
    public const R_INDEX_DONATION_TOP_TO= 3600;
    // 置顶文章
    public const R_INDEX_ARTICLES_TOP_KEY = 'cms-top-F3ufc';
    public const R_INDEX_ARTICLES_TOP_TO = 3600*3;
    // 文章详情
    public const R_INDEX_ARTICLES_DETAIL_KEY = 'cms-detail-jfi0a-%d';
    public const R_INDEX_ARTICLES_DETAIL_TO = 3600*3;
    // 开通的城市
    public const R_CITY_ENABLED_KEY='city_enabled';
    public const R_CITY_ENABLED_TO = self::EXPIRE_TIME_DEFAULT_DAY;
    // 城市的地图围栏
    public const R_CITY_MAP_FENCE_KEY='city_map_fence_%d';
    public const R_CITY_MAP_FENCE_TO = self::EXPIRE_TIME_DEFAULT_DAY_HALF;
    /**
     * 城市的区县
     */
    public const R_CITY_DISTRICTS_KEY = 'city_districts-%d';
    public const R_CITY_DISTRICTS_TO = self::EXPIRE_TIME_DEFAULT_DAYS;


    // 企业通勤 存储 token 啥的
    public const R_ENTERPRISE_COMMUTE_REFRESH_TOKEN_KEY = 'JsIajgYwg';
    public const R_ENTERPRISE_COMMUTE_ACCESS_TOKEN_KEY = 'PYoeJbdaL';
    // 机场数据
    public const R_CITY_AIRPORT_KEY="city_airport_%d";
    public const R_CITY_AIRPORT_TO= self::EXPIRE_TIME_DEFAULT;
    // 企业信息
    public const R_ENTERPRISE_INFO_KEY="enterprise_info_%d";
    // 三方订单查询接口
    public const R_THIRD_ORDER_SEARCH = 'third_order_%s';
    /**
     * 内部三方接口：如村民之家，企业通勤的接口缓存
     * %s = 手机号 -%d = 见R_INNER_THIRD_SOURCE_XXX
     */
    public const R_INNER_THIRD_USER_NOT_EXISTS = 'inner_third_user_empty-%d-%s';
    /**
     * 内部三方接口: cmzj:1
     */
    public const R_INNER_THIRD_SOURCE_CMZJ = 1;
    /**
     * 内部三方接口: commute:2
     */
    public const R_INNER_THIRD_SOURCE_COMMUTE = 2;
    /**
     * 用户订单列表缓存key
     * %d:用户ID
     */
    public const R_USER_ORDER_LIST_KEYS = 'user-orders_keys-%d';
    /**
     * 司机订单列表缓存key
     * %d:司机ID
     */
    public const R_DRIVER_ORDER_LIST_KEYS = 'driver-orders_keys-%d';
    /**
     * 司机订单列表缓存key
     * %d:司机ID
     */
    public const R_DRIVER_WAIT_ORDER_LIST_KEYS = 'driver-wait_orders_keys-%d';
    /**
     * orders_list存储时长
     */
    public const R_ORDER_LIST_TO = 86400;
    /**
     * 泛用缓存key
     * %s:缓存名，%s其他
     */
    public const R_CACHEABLE_KEY='cacheable-%s-%s';
    public const R_CACHEABLE_TO = 86400;


}
